
main_init = function(mc){

 b=mc.getBounds(mc._parent);
 w = b.xMax - b.xMin - 6;
 h = b.yMax - b.yMin - 6;
 xo = b.xMin + 3;
 yo = b.yMin + 3;

 if (flicker_shapes_only){
  mc.duplicateMovieClip("white",7);
  mc.duplicateMovieClip("black",8);
  c_black = new Color(black);
  c_black.setRGB(0x000000);
  c_white = new Color(white);
  c_white.setRGB(0xffffff);
 } else {
  createEmptyMovieClip("white",7);
  createEmptyMovieClip("black",8);
  white.lineStyle();
  black.lineStyle();
  white.beginFill(0xffffff);
  black.beginFill(0);
  white.moveTo(xo-3,yo-3);
  black.moveTo(xo-3,yo-3);
  white.lineTo(xo+w+3,yo-3);
  black.lineTo(xo+w+3,yo-3);
  white.lineTo(xo+w+3,yo+h+3);
  black.lineTo(xo+w+3,yo+h+3);
  white.lineTo(xo-3,yo+h+3);
  black.lineTo(xo-3,yo+h+3);
  white.endFill();
  black.endFill();
 }
 black._alpha = white._alpha = 0;

 scratch_frame = 0;
 sub_delay = 0;

}

// main_effect function

main_effect = function(mc,frame){

 if (frame % effect_slowdown == 0){

  if (random_error){

   createEmptyMovieClip("scratch",6);
   scratch.lineStyle(1,0xffffff,90);
   if (scratch_frame > 0){
    scratch.moveTo(scratch_x,yo + (scratch_frame == 1 ? Math.random() * h : - 3));
    scratch.lineTo(scratch_x,yo + (scratch_frame == scratch_frames ? Math.random() * h : h + 3));
    scratch_frame--;
   } else {
    if (Math.random() > 0.99){
     scratch_x = xo + Math.random() * w;
     scratch_frame = scratch_frames = Math.floor(2 + Math.random() * 18);
    }
   }
   for (i=0; i<4; i++){
    if (Math.random() > 0.98){
     x = xo + Math.random() * w;
     y = yo + Math.random() * h;
     scratch.moveTo(x,y);
     scratch.lineTo(x + 1, y + 1);
    }
   }
   for (i=0; i<4; i++){
    if (Math.random() > 0.95){
     x = xo + Math.random() * (w-12);
     scratch.lineStyle(1,0xffffff,Math.random() * effect_strongness * 2);
     scratch.moveTo(x,yo + Math.random() * h);
     scratch.lineTo(x + Math.random() * 12,yo + Math.random() * h);
    }
   }

   createEmptyMovieClip("dust",9);
   for (i=0; i<16; i++){
    x = xo + Math.random() * w;
    y = yo + Math.random() * h;
    dust.lineStyle(1 + Math.random() * 1.5,0,Math.random() * effect_strongness * 2);
    dust.moveTo(x,y);
    dust.lineTo(x + Math.random() * 6 - 3, y + Math.random() * 6 - 3);
   }

  }

  black._alpha = Math.random() * effect_strongness;
  white._alpha = Math.random() * effect_strongness / 2;

  if (shake){
   black._x = white._x = dust._x = scratch._x = mc._x = mc.__x + Math.floor(Math.random() * 2.05) - 1;
  }

 }
}

// sub_init function

sub_init = function(mc){
}

// sub_effect function

sub_effect = function(mc,frame){
 if (!all_at_once) if (frame % effect_slowdown == 0){
  state = Math.floor(Math.random()*3)-1;
  black[mc._name]._visible = (state == -1 ? true : false);
  white[mc._name]._visible = (state == 1 ? true : false);
 }
}

